<?
include_once("header_inc.php");

$tplIndex=new TplLoad;

if (getParam("submit","")=="")
	$tplIndex->assign("show_login",1);

$b_email=strToDb(getParam("b_email",""));
$b_pass=strToDb(getParam("b_pass",""));

if (getParam("submit","") AND $b_email AND $b_pass)
{
	$sql = "select id,name,email from $adv_tbl where email ='$b_email' AND password = '$b_pass' AND status=1";	
	$res = mysql_query($sql);
	$row=mysql_fetch_array($res);
	$id = $row["id"];
	$name = $row["name"];
	$email = $row["email"];
	
	if (mysql_num_rows($res)>0)
	{
		$tplIndex->assign("name","$name");
		$tplIndex->assign("email","$email");
		
		
		$sql = "select * from $banner_tbl where cid = $id";
		$res = mysql_query($sql);
		$i=0;
		while ($row=mysql_fetch_array($res))
		{
			$clicks = $row["clicks"];
			$hits = $row["hits"];
			$goto_url = $row["goto_url"];
			$status = $row["status"];
			$bid = $row["bid"];
			$filename = $row["filename"];
			$imgArray[$i]["clicks"]=$clicks;
			$imgArray[$i]["hits"]=$hits;
			$imgArray[$i]["goto_url"]=$goto_url;
			$imgArray[$i]["status"]=$status;
			$imgArray[$i]["filename"]=$filename;
			$imgArray[$i]["bid"]=$status;
			$i++;
		}
		
		$tplIndex->assign("banner_list",$imgArray);
		
		
		
		
		
		
		
	}
	else 
	{
		echo "<h3>Login failed</h3>Login failed for some reason. This may be because wrong username, password or that
		your account is not enabled yet.";
	}
	
}
$tplIndex->display("client_login.tpl");
require("footer_inc.php");
?>